package bam.dao.impl;

import java.util.List;

import org.hibernate.Query;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import bam.dao.DealInfoDao;
import bam.entity.Balance;
import bam.entity.Comboinfo;
import bam.entity.Vipmember;

public class DealInfoDaoImpl extends HibernateDaoSupport implements DealInfoDao {

	public Vipmember seluservip(int userid) throws Exception {
		Query query = this.getSession().createQuery("from Vipmember where userid = ?");		
		query.setParameter(0, userid);
		List<Vipmember> list = query.list();
		return list.isEmpty()?null:list.get(0);
	}

	public Comboinfo selusercombo(int userid) throws Exception {
		Query query = this.getSession().createQuery("from Comboinfo where users_id = ?");		
		query.setParameter(0, userid);
		List<Comboinfo> list = query.list();
		return list.isEmpty()?null:list.get(0);
	}

	public Balance seluserbal(int userid) throws Exception {
		Query query = this.getSession().createQuery("from Balance where userid = ?");		
		query.setParameter(0, userid);
		List<Balance> list = query.list();
		return list.isEmpty()?null:list.get(0);
	}

}
